using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UserUI : MonoBehaviour
{
    private IUserAction action;
    GUIStyle style1 = new GUIStyle();
    GUIStyle style2 = new GUIStyle();
    public string message = "";
    int screenWidth, screenHeight;
    // Start is called before the first frame update
    void Start()
    {
        this.GetComponent<AudioSource>().Play();
        action = this.transform.gameObject.GetComponent<IUserAction>();
        style1.normal.textColor = Color.red;
        style1.fontSize = 30;
        style2.normal.textColor = Color.yellow;
        style2.fontSize = 40;
    }

    // Update is called once per frame
    void Update()
    {
        screenHeight = Screen.height;
        screenWidth = Screen.width;
    }

    private void OnGUI()
    {
        //显示各种信息
        GUI.Label(new Rect(20, 10, 150, 50), "得分: ", style1);
        GUI.Label(new Rect(100, 10, 150, 50), action.GetScore().ToString(), style2);

        GUI.Label(new Rect(20, 50, 150, 50), "剩余箭矢数: ", style1);
        GUI.Label(new Rect(200, 50, 150, 50), action.GetArrowNum().ToString(), style2);

        GUI.Label(new Rect(20, 100, 150, 50), action.GetMessage(), style1);
    }
}
